#pragma once
#include "ALBaseSaliency.h"
typedef unsigned int UINT;

class CALSGMR : public CALBaseSaliency
{
public:
	CALSGMR();
	CALSGMR(CALStepItem* pStepItem);
	~CALSGMR();

public:
	//https://github.com/abin24/Saliency-detection-toolbox

	virtual void test();
	virtual void convert();
	virtual void convert(const Mat &src, Mat &dst);

public:
	void calculateSaliencyMap(Mat *img, Mat* dst);
	Mat GeneSal(const Mat &img);
	Mat Sal2Img(const Mat &superpixels, const Mat &Sal);
	Mat GeneSp(const Mat &img);

private:
	Mat GeneAdjMat(const Mat &spmat);
	int GeneFeature(const Mat &img, const Mat &superpixels, const int feaType, Mat &feaSpL, Mat &feaSpA, Mat &feaSpB, Mat &spNpix, Mat &spCnt);
	Mat GeneWeight(const vector<float> &feaSpL, const vector<float> &feaSpA, const vector<float> &feaSpB, const Mat &superpixels, const vector<int> &bd, const Mat &adj);
	vector<int> GeneBdQuery(const Mat &superpixels, const int type);
	Mat GeneY(const vector<int> &bd);
	Mat inveMat(const Mat &weight, const Mat &Y);

private:
	int spNumMax;
	double compactness;
	float alpha;
	float theta;
	int spNum;

};

